package com.klangner.math.parser.javacc;

import junit.framework.TestCase;

import com.klangner.math.ast.Node;
import com.klangner.math.parser.javacc.JavaccParser;

public class BasicParserTestCase extends TestCase {

	/** 
	 * Test data for parser. 
	 */
	private static final String[] testData = {
		"2+3",
		"2*3",
		"2*3-12",
		"3+x",
		"3*x^2+2*x^2",
		"(3*x)^2+(2*x)^a"
	};
	
	public void testData() {
		Node document;
		JavaccParser parser;
		
		for(int i = 0; i < testData.length; i++){

			parser = new JavaccParser( testData[i] );
			document = parser.parse();
		
			assertEquals(testData[i], document.toString());
		}
	}
	
}
